package com.tarena.lbs.basic.web.controller;

import com.tarena.lbs.base.protocol.exception.BusinessException;
import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.basic.web.service.UserGroupService;
import com.tarena.lbs.pojo.basic.param.UserGroupParam;
import com.tarena.lbs.pojo.basic.query.UserGroupQuery;
import com.tarena.lbs.pojo.basic.vo.UserGroupVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserGroupController {
    @Autowired
    private UserGroupService userGroupService;
    //后台查询用户人群列表
    @PostMapping("/admin/basic/userGroup/list")
    public Result<PageResult<UserGroupVO>> userGroupList(@RequestBody UserGroupQuery query)
        throws BusinessException{
        PageResult<UserGroupVO> voPages=userGroupService.userGroupList(query);
        return new Result<>(voPages);
    }
    @PostMapping("/admin/basic/userGroup/save")
    public Result<Void> userGroupSave(@RequestBody UserGroupParam param)
        throws BusinessException{
        userGroupService.userGroupSave(param);
        return Result.success();
    }
}
